.model  tiny
.386
.code
org     100h

code_begin      label   near
        mov     ah, 9
        mov     dx, offset message
        int     21h
        mov     ah, 4ah
        mov     bx, ((offset code_end - offset code_begin) + 20fh) shr 4
        mov     sp, ((offset code_end - offset code_begin) + 1ffh) and -2
        int     21h
        mov     ax, 352eh
        int     21h
        push    es
        push    bx
        pop     dword ptr ds:[offset jfar_2eh + 1]
        mov     ah, 25h
        mov     dx, offset new_2eh
        int     21h
        push    ds
        pop     es
        mov     bx, offset exec_block
        mov     word ptr ds:[bx + 4], cs
        mov     word ptr ds:[bx + 8], cs
        mov     word ptr ds:[bx + 0ch], cs
        mov     dword ptr ds:[bx + 0fh], "  c/"
        mov     ax, 4b00h
        mov     dx, offset instalar_com
        int     21h
        mov     ax, 252eh
        lds     dx, dword ptr ds:[offset jfar_2eh + 1]
        int     21h
        mov     ah, 4ch
        int     21h

new_2eh         proc    near
        push    ds
        push    es
        pusha
        push    cs
        pop     es
        mov     bx, offset exec_block
        mov     si, dx
        lea     di, word ptr [bx + 0eh]
        mov     word ptr cs:[bx + 2], di
        lodsb
        cbw
        mov     cx, ax
        add     al, 4
        stosb
        scasd
        rep     movsb
        push    cs
        pop     ds
        mov     ax, 4b00h
        mov     dx, offset command_com
        int     21h
        popa
        pop     es
        pop     ds
        iret

jfar_2eh        db      0eah, 'P', 'F', 'P', 'F'
new_2eh         endp

instalar_com    db      "instalar.com", 0
command_com     db      "z:\command.com", 0
exec_block      dw      0, 80h, 0, 5ch, 0, 6ch, 0

message         db "DOSBox installer fix for PC Liga", 0dh, 0ah
                db "by Peter Ferrie (peter_ferrie@hotmail.com)", 0dh, 0ah, "$"

                db 80h - (offset $ - offset message) dup (?)
code_end        label   near
end             code_begin
